package net.zoneland.knowledge.dao;

import java.util.List;
import net.zoneland.knowledge.model.QaBank;
import net.zoneland.knowledge.model.QaBankExample;
import net.zoneland.knowledge.model.QaBankWithBLOBs;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface QaBankMapper {
    @SelectProvider(type=QaBankSqlProvider.class, method="countByExample")
    long countByExample(QaBankExample example);

    @Delete({
        "delete from AITK_QA_BANK",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into AITK_QA_BANK (ID, BANKID, ",
        "CATEGORY, LEVEL1TITLE, ",
        "LEVEL2TITLE, LEVEL3TITLE, ",
        "QUESTION, TARGETID, ",
        "TARGETNAME, ORGDN, ",
        "ORGNAME, ORGDEPTNAME, ",
        "ORGDEPTDN, QA_SORT, ",
        "TAGS, SEARCHTEXT, ",
        "EXACTMATCH1, EXACTMATCH2, ",
        "EXACTMATCH3, DESCRIPTION, ",
        "STATUS, ANSCONTENTNAME, ",
        "CREATETIME, UPDATETIME, ",
        "CREATOR, UPDATER, ",
        "USERIDS, USERNAMES, ",
        "DEPTIDS, DEPTNAMES, ",
        "ROLEFLAGS, SHOWRICHTEXT, ",
        "SAMERICHTEXT, ANSCONTENT, ",
        "ANSCONTENTFILE, CUSTOMIZEDINFO, ",
        "PCRICHTEXT, MOARICHTEXT)",
        "values (#{id,jdbcType=VARCHAR}, #{bankId,jdbcType=VARCHAR}, ",
        "#{category,jdbcType=VARCHAR}, #{level1Title,jdbcType=VARCHAR}, ",
        "#{level2Title,jdbcType=VARCHAR}, #{level3Title,jdbcType=VARCHAR}, ",
        "#{question,jdbcType=VARCHAR}, #{targetId,jdbcType=VARCHAR}, ",
        "#{targetName,jdbcType=VARCHAR}, #{orgDn,jdbcType=VARCHAR}, ",
        "#{orgName,jdbcType=VARCHAR}, #{orgDeptName,jdbcType=VARCHAR}, ",
        "#{orgDeptDn,jdbcType=VARCHAR}, #{qaSort,jdbcType=DECIMAL}, ",
        "#{tags,jdbcType=VARCHAR}, #{searchtext,jdbcType=VARCHAR}, ",
        "#{exactmatch1,jdbcType=VARCHAR}, #{exactmatch2,jdbcType=VARCHAR}, ",
        "#{exactmatch3,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=DECIMAL}, #{ansContentName,jdbcType=VARCHAR}, ",
        "#{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, ",
        "#{creator,jdbcType=VARCHAR}, #{updater,jdbcType=VARCHAR}, ",
        "#{userids,jdbcType=VARCHAR}, #{usernames,jdbcType=VARCHAR}, ",
        "#{deptids,jdbcType=VARCHAR}, #{deptnames,jdbcType=VARCHAR}, ",
        "#{roleflags,jdbcType=VARCHAR}, #{showrichtext,jdbcType=DECIMAL}, ",
        "#{samerichtext,jdbcType=DECIMAL}, #{ansContent,jdbcType=CLOB}, ",
        "#{ansContentFile,jdbcType=BLOB}, #{customizedinfo,jdbcType=CLOB}, ",
        "#{pcRichText,jdbcType=CLOB}, #{moaRichText,jdbcType=CLOB})"
    })
    int insert(QaBankWithBLOBs record);

    @InsertProvider(type=QaBankSqlProvider.class, method="insertSelective")
    int insertSelective(QaBankWithBLOBs record);

    @SelectProvider(type=QaBankSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="BANKID", property="bankId", jdbcType=JdbcType.VARCHAR),
        @Result(column="CATEGORY", property="category", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL1TITLE", property="level1Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL2TITLE", property="level2Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL3TITLE", property="level3Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="QUESTION", property="question", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETID", property="targetId", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETNAME", property="targetName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDN", property="orgDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGNAME", property="orgName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTNAME", property="orgDeptName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTDN", property="orgDeptDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="QA_SORT", property="qaSort", jdbcType=JdbcType.DECIMAL),
        @Result(column="TAGS", property="tags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SEARCHTEXT", property="searchtext", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH1", property="exactmatch1", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH2", property="exactmatch2", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH3", property="exactmatch3", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="STATUS", property="status", jdbcType=JdbcType.DECIMAL),
        @Result(column="ANSCONTENTNAME", property="ansContentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="UPDATETIME", property="updatetime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="CREATOR", property="creator", jdbcType=JdbcType.VARCHAR),
        @Result(column="UPDATER", property="updater", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERIDS", property="userids", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERNAMES", property="usernames", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTIDS", property="deptids", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTNAMES", property="deptnames", jdbcType=JdbcType.VARCHAR),
        @Result(column="ROLEFLAGS", property="roleflags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SHOWRICHTEXT", property="showrichtext", jdbcType=JdbcType.DECIMAL),
        @Result(column="SAMERICHTEXT", property="samerichtext", jdbcType=JdbcType.DECIMAL),
        @Result(column="ANSCONTENT", property="ansContent", jdbcType=JdbcType.CLOB),
        @Result(column="ANSCONTENTFILE", property="ansContentFile", jdbcType=JdbcType.BLOB),
        @Result(column="CUSTOMIZEDINFO", property="customizedinfo", jdbcType=JdbcType.CLOB),
        @Result(column="PCRICHTEXT", property="pcRichText", jdbcType=JdbcType.CLOB),
        @Result(column="MOARICHTEXT", property="moaRichText", jdbcType=JdbcType.CLOB)
    })
    List<QaBankWithBLOBs> selectByExampleWithBLOBs(QaBankExample example);

    @SelectProvider(type=QaBankSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="BANKID", property="bankId", jdbcType=JdbcType.VARCHAR),
        @Result(column="CATEGORY", property="category", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL1TITLE", property="level1Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL2TITLE", property="level2Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL3TITLE", property="level3Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="QUESTION", property="question", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETID", property="targetId", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETNAME", property="targetName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDN", property="orgDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGNAME", property="orgName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTNAME", property="orgDeptName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTDN", property="orgDeptDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="QA_SORT", property="qaSort", jdbcType=JdbcType.DECIMAL),
        @Result(column="TAGS", property="tags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SEARCHTEXT", property="searchtext", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH1", property="exactmatch1", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH2", property="exactmatch2", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH3", property="exactmatch3", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="STATUS", property="status", jdbcType=JdbcType.DECIMAL),
        @Result(column="ANSCONTENTNAME", property="ansContentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="UPDATETIME", property="updatetime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="CREATOR", property="creator", jdbcType=JdbcType.VARCHAR),
        @Result(column="UPDATER", property="updater", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERIDS", property="userids", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERNAMES", property="usernames", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTIDS", property="deptids", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTNAMES", property="deptnames", jdbcType=JdbcType.VARCHAR),
        @Result(column="ROLEFLAGS", property="roleflags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SHOWRICHTEXT", property="showrichtext", jdbcType=JdbcType.DECIMAL),
        @Result(column="SAMERICHTEXT", property="samerichtext", jdbcType=JdbcType.DECIMAL)
    })
    List<QaBank> selectByExample(QaBankExample example);

    @Select({
        "select",
        "ID, BANKID, CATEGORY, LEVEL1TITLE, LEVEL2TITLE, LEVEL3TITLE, QUESTION, TARGETID, ",
        "TARGETNAME, ORGDN, ORGNAME, ORGDEPTNAME, ORGDEPTDN, QA_SORT, TAGS, SEARCHTEXT, ",
        "EXACTMATCH1, EXACTMATCH2, EXACTMATCH3, DESCRIPTION, STATUS, ANSCONTENTNAME, ",
        "CREATETIME, UPDATETIME, CREATOR, UPDATER, USERIDS, USERNAMES, DEPTIDS, DEPTNAMES, ",
        "ROLEFLAGS, SHOWRICHTEXT, SAMERICHTEXT, ANSCONTENT, ANSCONTENTFILE, CUSTOMIZEDINFO, ",
        "PCRICHTEXT, MOARICHTEXT",
        "from AITK_QA_BANK",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="BANKID", property="bankId", jdbcType=JdbcType.VARCHAR),
        @Result(column="CATEGORY", property="category", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL1TITLE", property="level1Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL2TITLE", property="level2Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL3TITLE", property="level3Title", jdbcType=JdbcType.VARCHAR),
        @Result(column="QUESTION", property="question", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETID", property="targetId", jdbcType=JdbcType.VARCHAR),
        @Result(column="TARGETNAME", property="targetName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDN", property="orgDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGNAME", property="orgName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTNAME", property="orgDeptName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ORGDEPTDN", property="orgDeptDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="QA_SORT", property="qaSort", jdbcType=JdbcType.DECIMAL),
        @Result(column="TAGS", property="tags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SEARCHTEXT", property="searchtext", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH1", property="exactmatch1", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH2", property="exactmatch2", jdbcType=JdbcType.VARCHAR),
        @Result(column="EXACTMATCH3", property="exactmatch3", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="STATUS", property="status", jdbcType=JdbcType.DECIMAL),
        @Result(column="ANSCONTENTNAME", property="ansContentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="UPDATETIME", property="updatetime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="CREATOR", property="creator", jdbcType=JdbcType.VARCHAR),
        @Result(column="UPDATER", property="updater", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERIDS", property="userids", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERNAMES", property="usernames", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTIDS", property="deptids", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTNAMES", property="deptnames", jdbcType=JdbcType.VARCHAR),
        @Result(column="ROLEFLAGS", property="roleflags", jdbcType=JdbcType.VARCHAR),
        @Result(column="SHOWRICHTEXT", property="showrichtext", jdbcType=JdbcType.DECIMAL),
        @Result(column="SAMERICHTEXT", property="samerichtext", jdbcType=JdbcType.DECIMAL),
        @Result(column="ANSCONTENT", property="ansContent", jdbcType=JdbcType.CLOB),
        @Result(column="ANSCONTENTFILE", property="ansContentFile", jdbcType=JdbcType.BLOB),
        @Result(column="CUSTOMIZEDINFO", property="customizedinfo", jdbcType=JdbcType.CLOB),
        @Result(column="PCRICHTEXT", property="pcRichText", jdbcType=JdbcType.CLOB),
        @Result(column="MOARICHTEXT", property="moaRichText", jdbcType=JdbcType.CLOB)
    })
    QaBankWithBLOBs selectByPrimaryKey(String id);

    @UpdateProvider(type=QaBankSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(QaBankWithBLOBs record);

    @Update({
        "update AITK_QA_BANK",
        "set BANKID = #{bankId,jdbcType=VARCHAR},",
          "CATEGORY = #{category,jdbcType=VARCHAR},",
          "LEVEL1TITLE = #{level1Title,jdbcType=VARCHAR},",
          "LEVEL2TITLE = #{level2Title,jdbcType=VARCHAR},",
          "LEVEL3TITLE = #{level3Title,jdbcType=VARCHAR},",
          "QUESTION = #{question,jdbcType=VARCHAR},",
          "TARGETID = #{targetId,jdbcType=VARCHAR},",
          "TARGETNAME = #{targetName,jdbcType=VARCHAR},",
          "ORGDN = #{orgDn,jdbcType=VARCHAR},",
          "ORGNAME = #{orgName,jdbcType=VARCHAR},",
          "ORGDEPTNAME = #{orgDeptName,jdbcType=VARCHAR},",
          "ORGDEPTDN = #{orgDeptDn,jdbcType=VARCHAR},",
          "QA_SORT = #{qaSort,jdbcType=DECIMAL},",
          "TAGS = #{tags,jdbcType=VARCHAR},",
          "SEARCHTEXT = #{searchtext,jdbcType=VARCHAR},",
          "EXACTMATCH1 = #{exactmatch1,jdbcType=VARCHAR},",
          "EXACTMATCH2 = #{exactmatch2,jdbcType=VARCHAR},",
          "EXACTMATCH3 = #{exactmatch3,jdbcType=VARCHAR},",
          "DESCRIPTION = #{description,jdbcType=VARCHAR},",
          "STATUS = #{status,jdbcType=DECIMAL},",
          "ANSCONTENTNAME = #{ansContentName,jdbcType=VARCHAR},",
          "CREATETIME = #{createtime,jdbcType=TIMESTAMP},",
          "UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},",
          "CREATOR = #{creator,jdbcType=VARCHAR},",
          "UPDATER = #{updater,jdbcType=VARCHAR},",
          "USERIDS = #{userids,jdbcType=VARCHAR},",
          "USERNAMES = #{usernames,jdbcType=VARCHAR},",
          "DEPTIDS = #{deptids,jdbcType=VARCHAR},",
          "DEPTNAMES = #{deptnames,jdbcType=VARCHAR},",
          "ROLEFLAGS = #{roleflags,jdbcType=VARCHAR},",
          "SHOWRICHTEXT = #{showrichtext,jdbcType=DECIMAL},",
          "SAMERICHTEXT = #{samerichtext,jdbcType=DECIMAL},",
          "ANSCONTENT = #{ansContent,jdbcType=CLOB},",
          "ANSCONTENTFILE = #{ansContentFile,jdbcType=BLOB},",
          "CUSTOMIZEDINFO = #{customizedinfo,jdbcType=CLOB},",
          "PCRICHTEXT = #{pcRichText,jdbcType=CLOB},",
          "MOARICHTEXT = #{moaRichText,jdbcType=CLOB}",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKeyWithBLOBs(QaBankWithBLOBs record);

    @Update({
        "update AITK_QA_BANK",
        "set BANKID = #{bankId,jdbcType=VARCHAR},",
          "CATEGORY = #{category,jdbcType=VARCHAR},",
          "LEVEL1TITLE = #{level1Title,jdbcType=VARCHAR},",
          "LEVEL2TITLE = #{level2Title,jdbcType=VARCHAR},",
          "LEVEL3TITLE = #{level3Title,jdbcType=VARCHAR},",
          "QUESTION = #{question,jdbcType=VARCHAR},",
          "TARGETID = #{targetId,jdbcType=VARCHAR},",
          "TARGETNAME = #{targetName,jdbcType=VARCHAR},",
          "ORGDN = #{orgDn,jdbcType=VARCHAR},",
          "ORGNAME = #{orgName,jdbcType=VARCHAR},",
          "ORGDEPTNAME = #{orgDeptName,jdbcType=VARCHAR},",
          "ORGDEPTDN = #{orgDeptDn,jdbcType=VARCHAR},",
          "QA_SORT = #{qaSort,jdbcType=DECIMAL},",
          "TAGS = #{tags,jdbcType=VARCHAR},",
          "SEARCHTEXT = #{searchtext,jdbcType=VARCHAR},",
          "EXACTMATCH1 = #{exactmatch1,jdbcType=VARCHAR},",
          "EXACTMATCH2 = #{exactmatch2,jdbcType=VARCHAR},",
          "EXACTMATCH3 = #{exactmatch3,jdbcType=VARCHAR},",
          "DESCRIPTION = #{description,jdbcType=VARCHAR},",
          "STATUS = #{status,jdbcType=DECIMAL},",
          "ANSCONTENTNAME = #{ansContentName,jdbcType=VARCHAR},",
          "CREATETIME = #{createtime,jdbcType=TIMESTAMP},",
          "UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},",
          "CREATOR = #{creator,jdbcType=VARCHAR},",
          "UPDATER = #{updater,jdbcType=VARCHAR},",
          "USERIDS = #{userids,jdbcType=VARCHAR},",
          "USERNAMES = #{usernames,jdbcType=VARCHAR},",
          "DEPTIDS = #{deptids,jdbcType=VARCHAR},",
          "DEPTNAMES = #{deptnames,jdbcType=VARCHAR},",
          "ROLEFLAGS = #{roleflags,jdbcType=VARCHAR},",
          "SHOWRICHTEXT = #{showrichtext,jdbcType=DECIMAL},",
          "SAMERICHTEXT = #{samerichtext,jdbcType=DECIMAL}",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(QaBank record);


    @Select({
            "<script>",
            "select",
            "a.ID, a.BANKID, a.CATEGORY, a.LEVEL1TITLE, a.LEVEL2TITLE, a.LEVEL3TITLE, a.QUESTION, a.TARGETID, ",
            "a.TARGETNAME, a.ORGDN, a.ORGNAME, a.ORGDEPTNAME, a.ORGDEPTDN, a.QA_SORT, a.TAGS, a.SEARCHTEXT, ",
            "a.EXACTMATCH1, a.EXACTMATCH2, a.EXACTMATCH3, a.DESCRIPTION, a.STATUS, a.ANSCONTENTNAME, ",
            "a.ROLEFLAGS, a.SHOWRICHTEXT, a.SAMERICHTEXT, a.ANSCONTENT, a.CUSTOMIZEDINFO, ",
            "a.PCRICHTEXT, a.MOARICHTEXT, a.USERIDS, a.DEPTIDS, a.SHOWNEW, b.ENABLED FAVORITE_STATUS",
            "from AITK_QA_BANK a",
            "left join AITK_FAVORITE b on a.ID = b.ES_QUESTION_ID and b.CREATOR_UID = #{userId,jdbcType=VARCHAR} ",
            "where 1=1 ",
            "<if test=\"record.orgDn != null and record.orgDn != ''\"> AND (a.ORGDN LIKE '%;' || #{record.orgDn,jdbcType=VARCHAR} ||';%' OR a.ORGDN LIKE '%;99;%')</if> ",
            "<if test=\"record.category != null and record.category != ''\"> AND a.CATEGORY=#{record.category,jdbcType=VARCHAR} </if> ",
            "and (a.level1title=#{record.level1Title,jdbcType=VARCHAR} or a.level2title=#{record.level2Title,jdbcType=VARCHAR} or a.level3title=#{record.level3Title,jdbcType=VARCHAR})",
            "order by a.QA_SORT asc",
            "</script>"
    })
    @Results({
            @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
            @Result(column="BANKID", property="bankId", jdbcType=JdbcType.VARCHAR),
            @Result(column="CATEGORY", property="category", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL1TITLE", property="level1Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL2TITLE", property="level2Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL3TITLE", property="level3Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="QUESTION", property="question", jdbcType=JdbcType.VARCHAR),
            @Result(column="TARGETID", property="targetId", jdbcType=JdbcType.VARCHAR),
            @Result(column="TARGETNAME", property="targetName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDN", property="orgDn", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGNAME", property="orgName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDEPTNAME", property="orgDeptName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDEPTDN", property="orgDeptDn", jdbcType=JdbcType.VARCHAR),
            @Result(column="QA_SORT", property="qaSort", jdbcType=JdbcType.DECIMAL),
            @Result(column="TAGS", property="tags", jdbcType=JdbcType.VARCHAR),
            @Result(column="SEARCHTEXT", property="searchtext", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH1", property="exactmatch1", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH2", property="exactmatch2", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH3", property="exactmatch3", jdbcType=JdbcType.VARCHAR),
            @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
            @Result(column="STATUS", property="status", jdbcType=JdbcType.DECIMAL),
            @Result(column="ANSCONTENTNAME", property="ansContentName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ROLEFLAGS", property="roleflags", jdbcType=JdbcType.VARCHAR),
            @Result(column="SHOWRICHTEXT", property="showrichtext", jdbcType=JdbcType.DECIMAL),
            @Result(column="SAMERICHTEXT", property="samerichtext", jdbcType=JdbcType.DECIMAL),
            @Result(column="ANSCONTENT", property="ansContent", jdbcType=JdbcType.CLOB),
            @Result(column="CUSTOMIZEDINFO", property="customizedinfo", jdbcType=JdbcType.CLOB),
            @Result(column="PCRICHTEXT", property="pcRichText", jdbcType=JdbcType.CLOB),
            @Result(column="MOARICHTEXT", property="moaRichText", jdbcType=JdbcType.CLOB),
            @Result(column="USERIDS", property="userids", jdbcType=JdbcType.VARCHAR),
            @Result(column="DEPTIDS", property="deptids", jdbcType=JdbcType.VARCHAR),
            @Result(column="SHOWNEW", property="showNew", jdbcType=JdbcType.BOOLEAN),
            @Result(column = "FAVORITE_STATUS", property = "favoriteStatus", jdbcType = JdbcType.BOOLEAN)
    })
    List<QaBankWithBLOBs> selectBySubject(@Param("record") final QaBank record, @Param("userId") String userId);

    @Select({
            "<script>",
            "select",
            "ID, BANKID, CATEGORY, LEVEL1TITLE, LEVEL2TITLE, LEVEL3TITLE, QUESTION, TARGETID, ",
            "TARGETNAME, ORGDN, ORGNAME, ORGDEPTNAME, ORGDEPTDN, QA_SORT, TAGS, SEARCHTEXT, ",
            "EXACTMATCH1, EXACTMATCH2, EXACTMATCH3, DESCRIPTION, STATUS, ANSCONTENTNAME, ",
            "CREATETIME, UPDATETIME, CREATOR, UPDATER, USERIDS, USERNAMES, DEPTIDS, DEPTNAMES, ",
            "ROLEFLAGS, SHOWRICHTEXT, SAMERICHTEXT, ANSCONTENT, ANSCONTENTFILE, CUSTOMIZEDINFO, ",
            "PCRICHTEXT, MOARICHTEXT",
            "from AITK_QA_BANK",
            "where ID in ",
            "<foreach collection='ids' index='index' item='item' open='(' separator=',' close=')'>",
            "#{item}</foreach> ",
            "</script>"
    })
    @Results({
            @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
            @Result(column="BANKID", property="bankId", jdbcType=JdbcType.VARCHAR),
            @Result(column="CATEGORY", property="category", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL1TITLE", property="level1Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL2TITLE", property="level2Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="LEVEL3TITLE", property="level3Title", jdbcType=JdbcType.VARCHAR),
            @Result(column="QUESTION", property="question", jdbcType=JdbcType.VARCHAR),
            @Result(column="TARGETID", property="targetId", jdbcType=JdbcType.VARCHAR),
            @Result(column="TARGETNAME", property="targetName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDN", property="orgDn", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGNAME", property="orgName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDEPTNAME", property="orgDeptName", jdbcType=JdbcType.VARCHAR),
            @Result(column="ORGDEPTDN", property="orgDeptDn", jdbcType=JdbcType.VARCHAR),
            @Result(column="QA_SORT", property="qaSort", jdbcType=JdbcType.DECIMAL),
            @Result(column="TAGS", property="tags", jdbcType=JdbcType.VARCHAR),
            @Result(column="SEARCHTEXT", property="searchtext", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH1", property="exactmatch1", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH2", property="exactmatch2", jdbcType=JdbcType.VARCHAR),
            @Result(column="EXACTMATCH3", property="exactmatch3", jdbcType=JdbcType.VARCHAR),
            @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
            @Result(column="STATUS", property="status", jdbcType=JdbcType.DECIMAL),
            @Result(column="ANSCONTENTNAME", property="ansContentName", jdbcType=JdbcType.VARCHAR),
            @Result(column="CREATETIME", property="createtime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="UPDATETIME", property="updatetime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="CREATOR", property="creator", jdbcType=JdbcType.VARCHAR),
            @Result(column="UPDATER", property="updater", jdbcType=JdbcType.VARCHAR),
            @Result(column="USERIDS", property="userids", jdbcType=JdbcType.VARCHAR),
            @Result(column="USERNAMES", property="usernames", jdbcType=JdbcType.VARCHAR),
            @Result(column="DEPTIDS", property="deptids", jdbcType=JdbcType.VARCHAR),
            @Result(column="DEPTNAMES", property="deptnames", jdbcType=JdbcType.VARCHAR),
            @Result(column="ROLEFLAGS", property="roleflags", jdbcType=JdbcType.VARCHAR),
            @Result(column="SHOWRICHTEXT", property="showrichtext", jdbcType=JdbcType.DECIMAL),
            @Result(column="SAMERICHTEXT", property="samerichtext", jdbcType=JdbcType.DECIMAL),
            @Result(column="ANSCONTENT", property="ansContent", jdbcType=JdbcType.CLOB),
            @Result(column="ANSCONTENTFILE", property="ansContentFile", jdbcType=JdbcType.BLOB),
            @Result(column="CUSTOMIZEDINFO", property="customizedinfo", jdbcType=JdbcType.CLOB),
            @Result(column="PCRICHTEXT", property="pcRichText", jdbcType=JdbcType.CLOB),
            @Result(column="MOARICHTEXT", property="moaRichText", jdbcType=JdbcType.CLOB)
    })
    List<QaBankWithBLOBs> selectByIds(@Param("ids") List<String> ids);
}